<template>
  <div class="swiper-container">
    <div class="swiper-wrapper">
      <div class="swiper-slide" v-for="(item, index) in banners" :key="index">
        <img :src="item" alt="" />
      </div>
      <!-- <div class="swiper-slide"><img src="" alt="" /></div>
      <div class="swiper-slide"><img src="" alt="" /></div> -->
    </div>
    <!-- 如果需要分页器 -->
    <div class="swiper-pagination">
        <span v-for="(item,index) in banners" :key="index"></span>
    </div>
  </div>
</template>

<script>
import Swiper from "../../node_modules/swiper/swiper-bundle";
export default {
  name: "Banners",
  props: ["banners"],
  mounted() {
    new Swiper(".swiper-container", {
      direction: "horizontal", // 垂直切换选项
      loop: true, // 循环模式选项
      // 如果需要分页器
      pagination: {
        el: ".swiper-pagination",
        clickable: true,
      },
    });
  },
};
</script>

<style lang="less" scoped>
@import "../../node_modules/swiper/swiper-bundle.css";
.swiper-container{
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    position: relative;
    img{
      width: 100%;
      height: 100%;
    }
}
</style>